package DomainLayer;

public class Tool
{
    private String title;
    private String barCode;
    private double deposit;
    private double pricePerDay;
    private boolean isLoaned;
    private int id;
    
    /**
     * @param title a title of tool.
     * @param barCode a unique bar code of the tool.
     * @param procePerDay an amount of money for renting a tool per day.
     * @param deposit an amount of money customer we'll need to leave to rent a tool.
     */
    public Tool(String title, String barCode, double pricePerDay, double deposit,int id ){
        this.title = title;
        this.barCode = barCode;
        this.pricePerDay=pricePerDay;
        this.deposit=deposit;
        this.id=id;
    }
    
    
    public void setTitle(String title){
        this.title = title;
    }
    
    public String toString(){
        return "Tool title: "+getTitle()+"\nTool code: "+getBarCode()+
        "\nTool's price: "+getPricePerDay()+"\nDeposit:  " +getDeposit() + "\nStatus: " 
        +getStatus() +"\n" + "ID: " +getID() + '\n';
    }
    
     public String toStrings(){
        return "Tool title: "+getTitle()+"\nTool code: "+getBarCode()+
        "\nTool's price: "+getPricePerDay()+"\nDeposit:  " +getDeposit() + "\n";
    }
    
    public String getTitle(){
        return title;
    }
    
  
    public String getBarCode(){
       return barCode;
    }
    
    public double getPricePerDay()
    {
        return pricePerDay;
    }
    
    public double getDeposit()
    {
        return deposit;
    }
    
    public boolean isLoaned()
    {
        return isLoaned;
    }
    
    public void loan()
    {
        isLoaned=true;
    }
    
    public void unloan()
    {
        isLoaned=false;
    }
    
    public int getID()
    {
        return id;
    }
    
    public String getStatus()
    {
        if(isLoaned())
        {
            return "Loaned";
        }
        else
        {
            return "Not Loaned";
        }
    }
}
